package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import play.db.jpa.Model;

/**
 * This entity identifies a Tutorial/Course. ie, tut 13 for csen401 is different
 * than tut 13 for csen403
 * 
 * @author mahmoudsakr
 */
@Entity
public class Tutorial extends Model {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5832407368259978875L;

	@Column (length = 5)
	public String number;

	@ManyToOne
	public Course course;

	@ManyToOne
	public Instructor instructor;

	@ManyToMany
	public List<Student> students;

	@OneToMany (mappedBy = "tutorial")
	public List<CourseRequest> requests;

	public Tutorial (Course course, String number) {
		this.course = course;
		this.number = number;
	}

	public String toString() {
		return "T" + number;
	}
}
